package com.fqgj.xjd.user.dao.impl;
import com.fqgj.common.base.AbstractBaseMapper;
import com.fqgj.xjd.user.dao.UserAuthPaymentDao;
import com.fqgj.xjd.user.entity.UserAuthPaymentEntity;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* User: zhangxingyun
* Date: 2017-07-20
* Time: 18:38:52.993
*/

@Repository
public class UserAuthPaymentDaoImpl extends AbstractBaseMapper<UserAuthPaymentEntity> implements UserAuthPaymentDao {

    @Override
    public UserAuthPaymentEntity selectUserAuthKeyByUserCodeAndType(String userCode, int type) {
        Map params = new HashMap();
        params.put("userCode",userCode);
        params.put("type",type);
        return getSqlSession().selectOne(getStatement("selectUserAuthKeyByUserCodeAndType"),params);
    }

    @Override
    public List<UserAuthPaymentEntity> selectUserAuthKeyByUserCodesAndType(List<String> userCodes, int type) {
        Map params = new HashMap();
        params.put("userCodes",userCodes);
        params.put("type",type);
        return getSqlSession().selectList(getStatement("selectUserAuthKeyByUserCodesAndType"),params);
    }

    @Override
    public int logicDelete(Long id) {
        Map<String, Object> map = new HashMap<>();
        map.put("id", id);
        map.put("deleteTime", new Date().getTime() / 1000);
        map.put("gmtModified", new Date());
        return getSqlSession().update(getStatement("logicDelete"), map);
    }
}